<?php
//用户控制器
class UserAction extends CommonAction {
	/**
     * [info description]个人信息设置
     * @return [type] [description]
     */
    public function info(){
        $employe_id=session('employe_id');
        $employe=M("Employe");
        $this->employeData=$employe->where("employe_id='".$employe_id."'")->select();
        $this->display("User:info");
    }


    /**
     * [editInfoPost description]编辑处理
     * @return [type] [description]
     */
    public function editInfoPost(){
        $employe=M('Employe');
        $employe_id=$_POST['employe_id'];
        $data['employe_photo']=$_POST['employe_photo'];
        $data['employe_sex']=$_POST['employe_sex'];
        $data['employe_identity_card']=$_POST['employe_identity_card'];
        $data['employe_brithday']=$_POST['employe_brithday'];
        $data['employe_if_marray']=$_POST['employe_if_marray'];
        $data['employe_nation']=$_POST['employe_nation'];
        $data['employe_politics']=$_POST['employe_politics'];
        $data['employe_account_type']=$_POST['employe_account_type'];
        $data['employe_account_native']=$_POST['employe_account_native'];
        $data['employe_phone']=$_POST['employe_phone'];
        $data['employe_qq']=$_POST['employe_qq'];
        $data['employe_email']=$_POST['employe_email'];
        $data['employe_family_phone']=$_POST['employe_family_phone'];
        $data['employe_family_address']=$_POST['employe_family_address'];
        $data['employe_graduate_school']=$_POST['employe_graduate_school'];
        $data['employe_graduate_time']=$_POST['employe_graduate_time'];
        $data['employe_degree']=$_POST['employe_degree'];
        $data['employe_specialty']=$_POST['employe_specialty'];
        $data['employe_social_relations']=$_POST['employe_social_relations'];
        $data['employe_work_exerience']=$_POST['employe_work_exerience'];
        $data['employe_work_skill']=$_POST['employe_work_skill'];
        $data['employe_remark']=$_POST['employe_remark'];
        $result=$employe->where("employe_id='".$employe_id."'")->save($data);
        if($result!=false){
            echo 'ok';
        }
        else{
            echo 'no';
        }
    }

    /**
     * [judgePassword description]修改前判断原始密码是否正确
     * @return [type] [description]
     */
    public function judgePassword(){
        $employe_password=I('employe_old_password');
        $employe_id=session('employe_id');
        $employe=M('Employe');
        $result=$employe->where("employe_id='".$employe_id."' and employe_other='".$employe_password."'")->find();
        if($result){
            echo 'ok';
        }
        else{
            echo 'no';
        }
    }

    /**
     * [changePassword description]修改密码模版跳转
     * @return [type] [description]
     */
    public function changePassword(){
        $this->display("User:changePassword");
    }

    /**
     * [changePasswordPost description]处理密码修改
     * @return [type] [description]
     */
    public function changePasswordPost(){
        $employe=M('Employe');
        $employe_id=session('employe_id');
        $data['employe_password']=md5(I('employe_password'));
        $data['employe_other']=I('employe_password');
        $result=$employe->where("employe_id='".$employe_id."'")->save($data);
        if($result!=false){
            echo 'ok';
        }
        else{
            echo 'no';
        }
    }
}